﻿using System.Collections.Generic;
using System.Linq;
using UnityEngine;

[System.Serializable]
public struct Level:ILevel
{
    [SerializeField]private int _levelNo;
    [SerializeField] private List<Vector2Int> _points;
    [SerializeField] private List<int> _lines;
    [SerializeField]private  Color _pieceColor;
    [SerializeField]private  Color _lineColor;

    public IEnumerable<Vector2Int> Points => _points;
    public IEnumerable<int> Line => _lines;

    public Color PieceColor => _pieceColor;

    public Color LineColor => _lineColor;

    public int LevelNo
    {
        get => _levelNo;
        set => _levelNo = value;
    }

    // public bool Locked => throw new System.NotImplementedException();


    public Level(int levelNo,IEnumerable<Vector2Int> points,IEnumerable<int> lines) : this()
    {
        Init(levelNo,points,lines);
    }

    private void Init(int levelNo,  IEnumerable<Vector2Int> points,IEnumerable<int> lines)
    {
        LevelNo = levelNo;
        _points = points.ToList();
        _lines = lines.ToList();
    }

    public Level(ILevel level) : this()
    {
        Init(level.LevelNo,level.Points,level.Line
        );
    }


}

public interface ILevel
{
    IEnumerable<Vector2Int> Points{ get; }
    IEnumerable<int> Line{ get; }
    int LevelNo { get; }
    
   
}